﻿Imports System
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.Activities
    Friend Class ExternalDataExchangeInterfaceTypeFilterProvider
        Implements ITypeFilterProvider
        ' Methods
        Public Sub New(ByVal serviceProvider As IServiceProvider)
            Me.serviceProvider = serviceProvider
        End Sub

        Public Function CanFilterType(ByVal type As Type, ByVal throwOnError As Boolean) As Boolean
            If type.IsInterface Then
                If (type.GetCustomAttributes(GetType(ExternalDataExchangeAttribute), False).Length <> 0) Then
                    Return True
                End If
                If throwOnError Then
                    Throw New Exception(SR.GetString("Error_InterfaceTypeNeedsExternalDataExchangeAttribute", New Object() { "InterfaceType" }))
                End If
            End If
            If throwOnError Then
                Throw New Exception(SR.GetString("Error_InterfaceTypeNotInterface", New Object() { "InterfaceType" }))
            End If
            Return False
        End Function


        ' Properties
        Public ReadOnly Property FilterDescription As String
            Get
                Return SR.GetString("ShowingExternalDataExchangeService")
            End Get
        End Property


        ' Fields
        Private serviceProvider As IServiceProvider
    End Class
End Namespace

